package com.ruoyi.system.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.domain.ZtfAppLearningRecord;
import com.ruoyi.system.service.IZtfAppLearningRecordService;
import com.ruoyi.system.service.IZtfLearningRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 课程记录Controller
 * 
 * @author ruoyi
 * @date 2025-06-06
 */
@RestController
@RequestMapping("app/system/record")
@Api(tags = "app课程记录相关接口")
public class ZtfAppLearningRecordController extends BaseController
{
    @Autowired
    private IZtfAppLearningRecordService iZtfAppLearningRecordService;

    /**
     * 新增课程记录
     */
//    @PreAuthorize("@ss.hasPermi('system:record:add')")
    @Log(title = "课程记录", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增我的课程记录")
    public AjaxResult add(@RequestBody ZtfAppLearningRecord ztfAppLearningRecord)
    {
       Long userId=SecurityUtils.getUserId();
       //设置用户id
        ztfAppLearningRecord.setUserId(userId.toString());
       //新增主键id
        ztfAppLearningRecord.setUuid(IdUtils.simpleUUID());
       return toAjax(iZtfAppLearningRecordService.insertZtfLearningRecord(ztfAppLearningRecord));
    }
    
}
